<?php

namespace App\Transformers\Personnel;

use League\Fractal\TransformerAbstract;
use App\Models\Personnel\Department;

/**
 * Class DepartmentTransformer
 * @package namespace App\Transformers\Personnel;
 */
class DepartmentTransformer extends TransformerAbstract{

    public function transform(Department $model){
        return [
            'id'                     => (int) $model->id,
            'parent_id'              => $model->parent_id,
            'name'                   => $model->name,
            'leader_user_id'         => $model->leader_user_id,
            'parent_leader_user_id'  => $model->parent_leader_user_id,
            'parent_branch_user_id'  => $model->parent_branch_user_id,
            'tel'                    => $model->tel,
            'fax'                    => $model->fax,
            'address'                => $model->address,
            'duty'                   => $model->duty,
            'created_user'           => $model->created_user,
            'updated_user'           => $model->updated_user,
            'created_at'             => $model->created_at->format('Y-m-d H:i:s')
        ];
    }
}
